/**
 * class represents a client TCP socket
 */
#ifndef C_CLIENT_TCP_SOCKET_H
#define C_CLIENT_TCP_SOCKET_H

#include "c_IPv4_Address.h"
#include "c_Flags.h"
#include "c_Engine.h"

namespace wiigi
{
   /**
    * Encapsulates a TCP sockets operations and state
    */
   class c_ClientTCP_Socket : public c_Flags< u8 >
   {
      public:
         
         /**
          * default constructor
          */
         c_ClientTCP_Socket( )
         {
            m_Socket = net_socket (AF_INET, SOCK_STREAM, IPPROTO_IP);
            
            return;
         }
         
         /**
          * destructor
          */
         ~c_ClientTCP_Socket()
         {
            if( INVALID_SOCKET != m_Socket )
            {
               net_close( m_Socket );
            }
            
            return;
         }
         
         e_Status connectToServer( const c_IPv4_Address& ServerAddress, u16 ServerPort );
         e_Status sendBuffer( const void* Buffer, u32 BufferSize );
         
      protected:
         /**
          * class flag defines
          */
         static const u8 d_Connected = 0x01;
         
      protected:
         
         s32                m_Socket;    /**< As returned by net_socket */      
         struct sockaddr_in m_Address;   /**< As required by net_connect */
         
   };  
   
   
   
}


#endif
